IF exists(SELECT * FROM dbo.sysobjects WHERE name='alleLeerlingenSchooljaar' AND xtype='P') 
BEGIN
	DROP PROCEDURE alleLeerlingenSchooljaar
END
GO

CREATE   procedure alleLeerlingenSchooljaar( 
@schooljaar char(4))
as
select distinct l.*,b.klas from alleGestarteLln as l
	left join beslis as b
	on b.inschrijvingsNr = l.inschrijvingsNr
	where b.jaar = @schooljaar
order by b.klas, l.naam1